﻿using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class UIMissionNameRender : MonoBehaviour
{
    public TextMeshProUGUI missionName;

    public Toggle toggle;

    public MissionData data;
    
    public MissionInfo missionInfo;
    private void Start()
    {
        //missionInfo = new MissionInfo();
    }
    private void Update()
    {
        if (toggle.isOn && missionInfo != null)
        {
            UIMissionItemData.instance.missionInfo = missionInfo;
            UIMissionItemData.instance.ShowMission();
        }
    }


    public void SetData(MissionData v)
    {
        data = v;   
        if (data != null)
        {
            missionInfo = StaticData.GetMissionInfo(v.id);
            missionName.text = missionInfo.name;
            gameObject.SetActive(true);
        }
        else gameObject.SetActive(false);
    }
    private void OnEnable()
    {
      
    }
}
